<template>
	<scroll-view class="content" scroll-y="true" :style="{marginTop: phoneNavHight,height: height}" @scroll="scroll">
		<view class="navbar" :style="{backgroundColor:navBackGroundColor,marginTop:phoneNavHight}">
			<u--image class="image" :showLoading="true" src="../../static/logo.png" width="40px" height="40px">
			</u--image>
			<text class="title">个人所得税</text>
			<view class="search">
				<u-search placeholder="搜一搜" v-model="keyword" :showAction='false'></u-search>
			</view>
			<view class="icon">
				<u-icon name="scan" color="#fff" size="28"></u-icon>
				<u-icon name="chat" color="#fff" size="28"></u-icon>
			</view>
		</view>
		<u-swiper :list="list1" :autoplay="autoplay" @change="change" :radius="0"></u-swiper>
		<view class="bg"></view>
		<view class="list-menu">
			<view class="menu">
				<view class="menu-item" v-for="item in 3" :key="item">
					<u--image class="img" :showLoading="true" src="../../static/logo.png" radius="50" width="40px" height="40px">
					</u--image>
					<text class="menu-title">我要钱</text>
				</view>
			</view>
			<view class="noticeBar">
				<u-notice-bar :text="noticeBar" icon="bell-fill" direction="column" mode="link"></u-notice-bar>
			</view>
		</view>
		<view class="" v-for="item in 50">
			{{item}}
		</view>
	</scroll-view>
</template>

<script>
	export default {
		data() {
			return {
				phoneNavHight: 0,
				navBackGroundColor: '',
				keyword: '',
				noticeBar: [1, 2, 3],
				list1: [
					'https://cdn.uviewui.com/uview/swiper/swiper1.png',
					'https://cdn.uviewui.com/uview/swiper/swiper2.png',
					'https://cdn.uviewui.com/uview/swiper/swiper3.png',
				],
				colorList: [`rgba(87,1,2,`, 'rgb(52,129,231,', 'rgb(128,192,198,'],
				autoplay: true,
				current: 0
			}
		},
		onLoad() {
			let systemInfo = uni.getSystemInfoSync()
			console.log(systemInfo);
			this.phoneNavHight = systemInfo.statusBarHeight + 'px'
			this.height = systemInfo.windowHeight - systemInfo.statusBarHeight + 'px'
		},
		methods: {
			change(e) {
				this.current = e.current
			},
			scroll(e) {
				const scrollTop = e.target.scrollTop
				this.autoplay = !new Boolean(scrollTop)
				this.navBackGroundColor = this.colorList[this.current] + scrollTop / 100 + ')'
			},
		}
	}
</script>

<style lang="scss">
	.content {

		.navbar {
			height: 80rpx;
			width: 95%;
			position: fixed;
			top: 0px;
			z-index: 9999;
			display: flex;
			align-items: center;
			padding: 15rpx 25rpx;

			.image {
				flex: 2;
			}

			.title {
				flex: 3;
				line-height: 80rpx;
				font-size: 30rpx;
				color: #ffffff;
				margin-left: 6rpx;
			}

			.search {
				flex: 5;
				margin-left: 10rpx;
			}

			.icon {
				flex: 3;
				margin-left: 4rpx;
				display: flex;
				justify-content: space-around;
			}
		}


		.bg {
			width: 100%;
			height: 140px;
			position: relative;
			z-index: -1;
			overflow: hidden;

			&::after {
				content: '';
				width: 120%;
				height: 100px;
				position: absolute;
				left: -10%;
				top: -40px;
				z-index: -1;
				border-radius: 0 0 60% 60%;
				background: #1496f1;
			}
		}

		.list-menu {
			width: 90%;
			margin: 0 auto;
			height: 300px;
			// border: 1px solid red;
			position: relative;
			top: -140px;

			.menu {
				width: 100%;
				height: 160rpx;
				background: #ffffff;
				display: flex;
				justify-content: space-around;
				align-items: center;
				box-shadow: 1px 2px 4px 1px rgba(0, 0, 0, 0.5);
				
				.menu-title {
					margin-top: 8rpx;
					font-size: 24rpx;
					text-align: center;
				}
				.img {
					// margin-left: 8rpx;
				}
			}

			.noticeBar {
				margin-top: 40rpx;
				border-radius: 20px;
			}
		}
	}
</style>
